<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #data{
            width: 100px;
            height: 100px;
            border: 1px solid #000;
        }
    </style>
</head>
<body>
    
    <div id="data">
        hello world!
    </div>

    <script>
        var data_box = document.querySelector("#data");

        data_box.addEventListener('click', function(e){
            var data = document.all('data').innerHTML;  // 获取值
            console.log(e);
            e.originalEvent.clipboardData.setData('text', data);
        })
    </script>
</body>
</html>